Updated with Set Host Name fuctionality -Tested with Arduino 1.6.13#50
Conversation
Updated to add Set Host Name fuctionality . Added Example Sketch for set Host Name.
Formating of output message in Sketch, Added linefeed
DhcpHostName.inoPlease use the Arduino IDE to do a Tools > Auto Format, which will fix some trailing whitespace and indentation issues. Dhcp.cpp, Ethernet.cppPlease conform to the formatting standard established throughout the rest of this file and library by using spaces instead of tabs. |
|
Hey guys, just wanna know whats the update on this and whether this can be expected to be merged. |
|
Similar to arduino/Arduino#5701 |
|
Have to ask too: is this extremely useful feature coming soon? |
|
@per1234 can this be merged? |
|
@Misiu, since @technofreakz never made the changes I requested 2.5 years ago, I would say no. However, I'm not the one who can decide whether or not this will be merged. |
|
Hello All, Thank you all for feedback's. Good Day. |
|
@technofreakz I've checked your changes yesterday and a simple sketch worked perfectly. |
Rotzbua
left a comment
There was a problem hiding this comment.
Just a quick look on the pr but the code has some more flaws in my opinion.
| else | ||
| { | ||
| buffer[16] = hostName; | ||
| buffer[17] = strlen(HOST_NAME); // length of hostname + last 3 bytes of mac address |
| { | ||
| buffer[16] = hostName; | ||
| buffer[17] = strlen(HOST_NAME); // length of hostname + last 3 bytes of mac address | ||
| strcpy((char*)&(buffer[18]), HOST_NAME); |
| #include "Arduino.h" | ||
| #include "utility/util.h" | ||
|
|
||
| char HOST_NAME[12] = "WIZNet"; |
There was a problem hiding this comment.
UPPERCASE is for constants.
| char HOST_NAME[12] = "WIZNet"; | ||
|
|
||
| void DhcpClass::setHostName(char *dhcpHost) { | ||
| strcpy(HOST_NAME, dhcpHost); |
| int beginWithDHCP(uint8_t *, unsigned long timeout = 60000, unsigned long responseTimeout = 4000); | ||
| int checkLease(); | ||
| // | ||
| void setHostName(char *); |
There was a problem hiding this comment.
Missing documentation: min max value; type of input: char array vs string.
| void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet); | ||
| int maintain(); | ||
|
|
||
| void hostName(char *dhcp_HostName); |
There was a problem hiding this comment.
Misleading naming. Should begin with set.
| char *EthernetClass::getHostName() | ||
| { | ||
| char *_getDhcpHostName = _dhcp ->getHostName(); | ||
| return _getDhcpHostName; |
There was a problem hiding this comment.
Can be simplified with previous line.
|
Please use File > Preferences to set Warnings to All. setHostName() should take a const char * as its input? Without const, passing a string literal will generate compiler warnings. The use of strcpy() also appears to be unsafe. It should check the string length and avoid overwriting beyond the end of the buffer. |
|
@technofreakz any updates on this? |
|
technofreakz seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Updated to add Set Host Name functionality .
Added Example Sketch for set Host Name.
For Arduino 1.6.13